// 基础数据点表配置
const BASIC_REGISTERS = [
  { addr: 0, name: '水位', unit: 'cm' },
  { addr: 1, name: '压力水位', unit: 'cm' },
  { addr: 2, name: '电池电压', unit: 'V' },
  { addr: 3, name: '剩余电量', unit: '%' },
  { addr: 4, name: '信号强度', unit: 'dBm' },
  { addr: 7, name: '信噪比', unit: 'dB' },
  { addr: 5, name: '温度', unit: '°C' },
  { addr: 6, name: '瞬时值', unit: 'cm' },
  { addr: 61, name: '雷达强度', unit: '' },
  { addr: 82, name: '探头温度', unit: '°C' },
  { addr: 101, name: '探头湿度', unit: '%' },
  { addr: 110, name: '保存条数', unit: '' },
  { addr: 111, name: '上传条数', unit: '' },
  { addr: 113, name: '设备版本', unit: '' },
  { addr: '28-42', name: 'IMEI号码', length: 15, type: 'string' },
  { addr: '72-76', name: 'SIM卡号', length: 20, type: 'string' },
  { addr: '104-109', name: 'UTC时间', length: 6, type: 'time' },
  { addr: '104-109', name: '北京时间', length: 6, type: 'time' }
]

// 高级数据点表配置
const ADVANCED_REGISTERS = {
  // 超声波相关
  ultrasonic: [
    { addr: 57, name: '超声波探头类型', writable: true },
    { addr: 83, name: '超声波校准温度', writable: true },
    { addr: 84, name: '超声波校准值', writable: true },
    { addr: 85, name: '超声波校准确认', writable: true },
    { addr: 64, name: '阻尼系数', writable: true },
    { addr: 65, name: '限幅幅度', writable: true },
    { addr: 86, name: '温度自动变化率', writable: true },
    { addr: 69, name: '超声波电压', writable: true },
    { addr: 59, name: '超声波空距', writable: true },
    { addr: 60, name: '空距调整值', writable: true }
  ],

  // 压力相关
  pressure: [
    { addr: 58, name: '压力探头类型', writable: true },
    { addr: 25, name: '压力校准斜率K', writable: true },
    { addr: 26, name: '压力校准偏置A', writable: true },
    { addr: 80, name: '压力零点切换值', writable: true },
    { addr: 87, name: '压力校准值', writable: true },
    { addr: 88, name: '压力确认校准', writable: true },
    { addr: 81, name: '传感器波特率', writable: true }
  ],

  // 数据采集相关
  dataCollection: [
    { addr: 62, name: '触发类型', writable: true },
    { addr: 56, name: '正常数据频率', writable: true },
    { addr: 77, name: '预警数据频率', writable: true },
    { addr: 78, name: '告警数据频率', writable: true },
    { addr: 23, name: '采集间隔', writable: true, unit: '秒' },
    { addr: 24, name: '上传间隔', writable: true, unit: '秒' }
  ],

  // 电池相关
  battery: [
    { addr: 71, name: '电源类型', writable: true },
    { addr: 52, name: '电压显示', writable: true },
    { addr: 53, name: '外接电源校准K', writable: true },
    { addr: 54, name: '外接电源偏置A', writable: true },
    { addr: 3, name: '剩余电量', writable: true },
    { addr: 69, name: '电池效率', writable: true },
    { addr: 70, name: '电池使用电量', writable: true }
  ],

  // 系统参数
  system: [
    { addr: 9, name: '休眠', writable: true },
    { addr: 10, name: '重启', writable: true },
    { addr: 16, name: '关机', writable: true },
    { addr: 19, name: 'RTC时间模式', writable: true },
    { addr: 93, name: 'RTC时钟参数', writable: true },
    { addr: '89-92', name: 'IP地址', writable: true, type: 'ip' },
    { addr: 18, name: '端口号', writable: true },
    { addr: 8, name: '初始化', writable: true }
  ]
}

// 波特率选项
const BAUDRATE_OPTIONS = [
  { value: 0, label: '1200' },
  { value: 1, label: '2400' },
  { value: 2, label: '4800' },
  { value: 3, label: '9600' },
  { value: 4, label: '19200' },
  { value: 5, label: '38400' },
  { value: 6, label: '57600' },
  { value: 7, label: '115200' }
]

// 校验位选项
const PARITY_OPTIONS = [
  { value: 0, label: '无校验' },
  { value: 1, label: '奇校验' },
  { value: 2, label: '偶校验' }
]

module.exports = {
  AUTH_LEVELS: {
    NORMAL: 0,    // 普通用户
    MAINTAIN: 1,  // 运维人员
    ADVANCED: 2,  // 高级用户
    DEVELOPER: 3  // 开发人员
  },
  BASIC_REGISTERS,
  ADVANCED_REGISTERS,
  BAUDRATE_OPTIONS,
  PARITY_OPTIONS
} 